<%@page import="cemetery.bean.park"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style>
.a4{
	  background-image:url("images/bj.jpg");
}

</style>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>园区管理</title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<link rel="stylesheet" href="css/order.css" />
<link rel="stylesheet" href="css/park.css" />
<link rel="styLesheet"
	href="${pageContext.request.contextPath}/layui/css/layui.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>

</head>

<body>
	<div class="img01">
		<img class="img02" src="images/white.png"><span>未售出(0)</span> <img
		style="height:10px"	class="img03" src="images/bj.jpg"><span>已售出(1)</span>
	</div>
	<div class="a1" id="layuitable" lay-filter="layuitable"
		lay-event="edit" style="height: 170px">

		
		<c:forEach items="${newsList}" var="n" varStatus="s">
			<c:choose>
				<c:when test="${n.burial==0}">
					<div class="a4 a">
				</c:when>
				<c:when test="${n.burial==1}">
					<div class="a3 a">
				</c:when>
				<c:otherwise>
					<div class="a2 a">
				</c:otherwise>
			</c:choose>
			<span style="display: none">:${n.id}</span>
			</br>
   园区:<span>${n.yqname}</span>
			</br>
   地址:<span>${n.addres}</span>
			</br>
  名字: <span>${n.name}</span>
			</br>
  电话: <span>${n.phone}</span>
			</br>
 是否下葬: <span>${n.burial}</span>
	</div>
	</c:forEach>
	</div>
	<!-- 修改DIV -->
	<div id="updateDiv" style="display: none">
		<input name="id" type="hidden" id="updateId" value="">
		<form class="layui-form" lay-filter="myupdateform" id="myupdateform"
			action="" style="margin-top: 40px">
			<div class="layui-form-item">
				<label class="layui-form-label">园区</label>
				<div class="layui-input-block">
					<input id="yq" type="text" name="yqname" readonly="readonly"
						class="layui-input" style="width: 500px">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">地址</label>
				<div class="layui-input-block">
					<input id="dizhi" type="text" name="addres" readonly="readonly"
						autocomplete="off" class="layui-input" style="width: 500px;">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">名字</label>
				<div class="layui-input-block">
					<input id="createDate-update" readonly="readonly" type="text"
						name="name" autocomplete="off" class="layui-input"
						style="width: 500px">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">电话</label>
				<div class="layui-input-block">
					<input id="phone" type="text" name="phone" readonly="readonly"
						autocomplete="off" class="layui-input" style="width: 500px">
				</div>
			</div>
			<div class="layui-form-item">
				<label id="xiazang" class="layui-form-label" >下葬否:</label>
				<div class="layui-input-block">
					<input pattern="/^[0|1]*$/"   id="burial" type="text" name="burial" lay-verify="required"
						autocomplete="off" placeholder="请输入0/1" autocomplete="off"
						class="layui-input" style="width: 100px;">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button type="submit" class="layui-btn" lay-submit
						lay-filter="myupdateform">立即提交</button>
					
				</div>
			</div>

		</form>

	</div>
</body>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-1.12.4.js"></script>
<script src="${pageContext.request.contextPath}/layui/layui.js"
	type="text/javascript"></script>
<script>
$(function(){
	layui.use(['form'],function(){
		var form=layui.form;
	$(".a").each(function(){
		  $(this).click(function(){
			var yqname=$(this).children("span").eq(1).text();
			var addres=$(this).children("span").eq(2).text();
			var name=$(this).children("span").eq(3).text();
			var phone=$(this).children("span").eq(4).text();
			var burial=$(this).children("span").eq(5).text();
			//弹出
			layer.open({
				  type: 1,
				  title: false,
				  closeBtn: 0,
				  shadeClose: true,
				  skin: 'yourclass',
				  content: $('#updateDiv'),
				  area: ['700px', '400px'],
				});
			
			$.ajax({
				url:'${pageContext.request.contextPath}/parkServlet?',
				data:{
				"action":"chaxunfz",
				"name":name
				},//发送到服务器的数据	
				type:'post',
				dataType:'json',
				success:function(data){
					$("#createDate-update").val(data.data.name);
					$("#yq").val(yqname);
					$("#dizhi").val(addres);
					$("#phone").val(phone);
					$("#burial").val(burial);	
				}
			});
					
			form.on('submit(myupdateform)',function(){
				var myformdata=form.val('myupdateform');
				$.ajax({
					url:'${pageContext.request.contextPath}/parkServlet?action=update',
					data:myformdata,//发送到服务器的数据	
					type:'post',
					dataType:'json',
					success:function(data){
						if(data.code=="0"){
							location.reload('layuitable');
							layer.closeAll();	
						}
						layer.msg(data.msg);
					}
				});
				//阻止提交
				return false;
			});
			});		  
	});	
	
	});
});
	
	</script>
<script>
	$(function(){
		$("#xiazang").css("margin-left","1px");
		
	})



</script>
</html>